import 'package:dio/dio.dart';
import 'uidata.dart';

class DioHelper {
  static String BaseUrl = UIData.apiServer2;

  static Future<Response> Post(String Url, dynamic data) async {
    var dio = new Dio();
    dio.options.baseUrl = BaseUrl;
    dio.options.headers['auth'] = UIData.token;
    Response response = await dio.post(Url, data: data);
    return response;
  }

  static Future<Response> Get(String Url, dynamic data) async {
    var dio = new Dio();
    dio.options.headers['auth'] = UIData.token;
    dio.options.baseUrl = BaseUrl;
    print(BaseUrl + Url);
    Response response = await dio.get(Url);
    return response;
  }

  static Future<Response> Post2(
      String baseUrl, String Url, dynamic data) async {
    var dio = new Dio();
    dio.options.headers['auth'] = UIData.token;
    dio.options.baseUrl = baseUrl;
    Response response = await dio.post(Url, data: data);
    return response;
  }

  static Future<Response> Get2(String baseUrl, String Url, dynamic data) async {
    var dio = Dio();
    dio.options.headers['auth'] = UIData.token;
    dio.options.baseUrl = baseUrl;
    print(baseUrl + Url);
    Response response = await dio.get(Url);
    return response;
  }
}
